{block name="circle_layout"}
	{include file="common:common_layout"}
{/block}
{extend name="common/layout" /}
{block name="style"}{/block}
{block name="content"}
<div class="base-layout">
    <div class="mainbox">
        {include file="circle:manage:top" /}
        
        <table class="base-table-style">
            <thead>
            <tr>
                <th class="w30"></th>
                <th class="tl">成员</th>
                <th class="w70">话题</th>
                <th class="w70">回复</th>
                <th class="w100">加入时间</th>
                <th class="w100">最后发言</th>
                <th class="w70">禁言</th>
                <th class="w120">操作</th>
            </tr>
            <tr>
                <?php if(!empty($cm_list)){?>
                <td class="tc"><input id="all" class="checkall" type="checkbox" /></td>
                <td colspan="5" class="batches"><label for="all" class="handle-btn"><i class="ac0"></i>全选</label>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setmanage')}?type=yes&c_id=<?php echo $c_id;?>" name="cm_id" confirm="最多只能添加<?php echo sysconf('circle_managesum');?>个管理员，超出部分不会被添加。" title="设为管理"><i class="ac1"></i>管理</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setmanage')}?type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="取消管理"><i class="ac2"></i>取消管理</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=speak&type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="禁言"><i class="ac4"></i>禁言</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=speak&type=yes&c_id=<?php echo $c_id;?>" name="cm_id" title="解除禁言"><i class="ac3"></i>解除禁言</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=star&type=yes&c_id=<?php echo $c_id;?>" name="cm_id" title="设为明星"><i class="ac8"></i>明星</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=star&type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="取消明星"><i class="ac9"></i>取消明星</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/delmember')}?c_id=<?php echo $c_id;?>" name="cm_id" confirm="确认删除" title="删除"><i class="ac5"></i>删除</a></td>
                <?php }?>
                <td colspan="20"><form method="get" class="manage-search-member">
                    <input type="hidden" name="c_id" value="<?php echo $c_id?>" />
                    <input name="mname" type="text" class="s-txt" placeholder="输入用户名" value="<?php echo I('get.mname');?>" maxlength="20" />
                    <input type="submit" class="s-btn" title="查找" value="&nbsp;"/>
                </form></td>
            </tr>
            </thead>
            <tbody>
            <?php if(!empty($cm_list)){?>
            <?php foreach (($cm_list) as $val){?>
            <tr>
                <td><input class="checkitem" type="checkbox" value="<?php echo $val['member_id'];?>"></td>
                <td><dl class="member-base"><dt class="member-name"><a href="javascript:void(0)" target="_blank"><?php echo $val['member_name'];?></a><?php echo memberIdentity($val['is_identity']);?></dt><dd class="member-avatar-s"><img src="<?php echo $val['member_avatar'];?>" /><?php if($val['is_star']){echo '<dd class="member-star" title="明星成员"></dd>';}?></dd>
                </dl></td>
                <td><?php echo $val['cm_thcount'];?></td>
                <td><?php echo $val['cm_comcount'];?></td>
                <td class="time"><?php echo @date('Y-m-d', $val['cm_jointime']);?></td>
                <td class="time"><?php if(empty($val['cm_lastspeaktime'])){echo '--';}else{echo @date('Y-m-d', $val['cm_lastspeaktime']);}?></td>
                <td><?php if($val['is_allowspeak'] == 1){echo '允许';}else{echo '禁止';}?></td>
                <td class="handle"><?php if($val['is_identity'] == 1){?>
                    --
                    <?php }else{?>
                    <?php if($val['is_allowspeak'] == 1){?>
                    <a href="javascript:void(0);" onclick="settingmember('speak','no',<?php echo $val['member_id'];?>);">禁言</a>
                    <?php }else{?>
                    <a href="javascript:void(0);" onclick="settingmember('speak','yes',<?php echo $val['member_id'];?>);">解除禁言</a>
                    <?php }?>
                        |&nbsp;<a href="javascript:void(0)" onclick="delmember(<?php echo $val['member_id'];?>);">删除</a>
                    <?php }?></td>
            </tr>
            <?php }?>
            <?php }else{?>
            <tr>
                <td colspan="20" class="noborder"><p class="no-record">没有符合条件的记录</p></td>
            </tr>
            <?php }?>
            </tbody>
            <?php if(!empty($cm_list)){?>
            <tfoot>
            <tr>
                <th class="tc"><input id="all" class="checkall" type="checkbox" /></th>
                <th colspan="20" class="batches"><label for="all" class="handle-btn"><i class="ac0"></i>全选</label>
                	<a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setmanage')}?type=yes&c_id=<?php echo $c_id;?>" name="cm_id" confirm="最多只能添加<?php echo sysconf('circle_managesum');?>个管理员，超出部分不会被添加。" title="设为管理"><i class="ac1"></i>管理</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setmanage')}?type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="取消管理"><i class="ac2"></i>取消管理</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=speak&type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="禁言"><i class="ac4"></i>禁言</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=speak&type=yes&c_id=<?php echo $c_id;?>" name="cm_id" title="解除禁言"><i class="ac3"></i>解除禁言</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=star&type=yes&c_id=<?php echo $c_id;?>" name="cm_id" title="设为明星"><i class="ac8"></i>明星</a>
                    <a href="javascript:void(0);" class="handle-btn" nctype="batchbutton" uri="{:url('circle/manage/setting')}?sign=star&type=no&c_id=<?php echo $c_id;?>" name="cm_id" title="取消明星"><i class="ac9"></i>取消明星</a>
                    <a href="javascript:void(0);" class="handle-btn" onclick="delBatchMember();" title="删除"><i class="ac5"></i>删除</a></th>
            </tr>
            <tr><td colspan="20"><div class="pagination"><?php echo $show_page;?></div></td></tr>
            </tfoot>
            <?php }?>
        </table>
    </div>
    <div class="sidebar">
        {include file="circle:manage:sidebar" /}

    </div>
</div>
<script src="__CIRCLE_RESOURCE__/js/circle_manage.js"></script>
<script>
    function settingmember(sign, type, id){
        _uri = "<?php echo url('/circle/manage/setting');?>?sign="+sign+"&type="+type+"&c_id=<?php echo $c_id;?>&cm_id="+id;
        ajaxget(_uri);
    }

    function delmember(id){
        _uri = "<?php echo url('/circle/manage/delmember');?>?c_id=<?php echo $c_id;?>&cm_id="+id;
        ajax_form("delmember", '提示信息', _uri, 360);
    }

    function delBatchMember() {
        /* 获取选中的项 */
        var items = '';
        $('.checkitem:checked').each(function(){
            items += this.value + ',';
        });
        if (items == '') {
            return false;
        }
        items = items.substr(0, (items.length - 1));
        delmember(items);
    }
</script>
{/block}